// 左侧导航
$(document).ready(function () {
  var liArr = $('.fish-left-nav').children('li');
  var iArr = liArr.children('i');
  var innerArr = $('.fish-left-nav li ul');
  var innerLiArr = innerArr.children('li');
  console.log(liArr,innerArr);
  for (var i = 0; i < liArr.length; i++) {
    (function (index) {
      liArr[i].onclick = function (e) {
        // console.log(this);
        var thisUl = $(this).find('ul');
        for (var k = 0; k < liArr.length; k++) {
          iArr.eq(k).removeClass('icon-shangjianhao').addClass('icon-xiajianhao')
        }
        if (thisUl.length == 0) {
          innerLiArr.removeClass('active');
          $(this).addClass('active');
        }else {
          var hasActive = thisUl[0].style.display;
          if(hasActive == 'block') {
            thisUl.slideUp(300);
          }else {
            // $(this).children('i').removeClass('icon-xiajianhao').addClass('icon-shangjianhao');
            // innerArr.slideUp(300);
            thisUl.slideDown(300);
          }
        }
      }
    })(i);
  }
  for (var i = 0; i < innerLiArr.length; i++) {
    innerLiArr[i].onclick = function (e) {
      e.stopPropagation();
      liArr.removeClass('active');
      innerLiArr.removeClass('active');
      $(this).addClass('active');
      return false;
    }
  }
});
